//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __DIRECT__LIST_H__
#define __DIRECT__LIST_H__

class SingleListNode
{
public:
    Void *operator new(size_t size, Void* pv) { return pv; }

    Void *operator new(size_t size) { return malloc(size); }

    Void operator delete(Void* pv) { free(pv); }

    SingleListNode()
    {
        m_next = NULL;
    }

    SingleListNode * Next()
    {
        return m_next;
    }

    SingleListNode * Insert(SingleListNode * node)
    {
        node->m_next = m_next;
        m_next = node;

        return node;
    }

    SingleListNode * Detach(SingleListNode * pre)
    {
        assert(pre != this);
        pre->m_next = m_next;

        return this;
    }

public:
    SingleListNode        * m_next;
};

#endif
